package com.bike.enumItem;

import java.util.HashMap;
import java.util.Map;

public enum BikeItemEnum {
	SUCCESS(0,"正常"), 
	INVI_ERROR(1,"骑行"),
	CODE_ERROR(2,"预约"),
	UPDATE_ERROR(3,"故障");
	
	int code;
	String msg;
	
	BikeItemEnum(int code,String msg){
		this.code=code;
		this.msg=msg;
	}
	public int getCode(){
		return code;
	}
	public static String getMsg(int code){
		for(BikeItemEnum rce:BikeItemEnum.values()){
			if(rce.code==code){
				return rce.getMsg();
			}
		}
		return "";
	}
	public String getMsg(){
		return msg;
	}
	public static Map<String,Object> getMapForCode(BikeItemEnum codeEnum){
		Map<String,Object> map=new HashMap<String, Object>();
		for(BikeItemEnum rce:BikeItemEnum.values()){
			if(rce==codeEnum){
				map.put("code", rce.code);		
				map.put("msg", rce.msg);		
				break;
			}
		}
		return map;
	}
}
